public class Demo4 {
    public static void main(String[] args) throws InterruptedException {
        Thread t1=new Thread(()->{
           Thread currentThread=Thread.currentThread();
           while (!currentThread.isInterrupted()){
               System.out.println("Hello t1");
               try {
                   Thread.sleep(1000);
               } catch (InterruptedException e) {
                   System.out.println("调整catch部分");
                   break;   //退出循环
               }
           }
            System.out.println("t1线程结束");
        });
        t1.start();
        Thread.sleep(3000);
        t1.interrupt();
    }
}
